<template>
	<view class="content">
		<view class="topmxx">
			<view class="toppar">
				<view class="cf fs30 ">
					积分剩余
				</view>
				<view class="dis_f aic    mt50">
					<view class="cf" style="font-size: 100rpx;">
						{{balance}}
					</view>

				</view>
			</view>
		</view>
		<view class="dis_f aic jub lis mt20" v-for="(item,index) in list" :key="index">
			<view class="dis_f aic">

				<view class="ml20">
					<view class="fs30 c6">
						{{item.type_cn}}
					</view>
					<view class="mt10 cbd fs24">
						订单号:{{item.sn}}
					</view>
				</view>
			</view>
			<view class="ml20">
				<view class="fs30 cred" style="text-align: right;" v-if="item.price_type == 0">
					-{{item.price}}
				</view>
				<view class="fs30 cred" style="text-align: right;" v-if="item.price_type == 1">
					+{{item.price}}
				</view>
				<view class="mt10 cbd fs24">
					{{item.addtime}}
				</view>
			</view>
		</view>

		<view class="dis_f juc cac fs26" style="padding: 30rpx;" v-if="list.length == 0">
			暂无数据
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				list: [],
				page: 1,
				pageConten: 0,
				loadstatus: '上拉加载更多',
				user: '',
				balance: 0
			}
		},
		onLoad() {
			this.user = uni.getStorageSync('userInfo')
			this.postlist()
		},
		onReachBottom() {
			if (this.page < this.pageConten) {
				this.page++
				this.postlist()
			} else if (this.page == this.pageConten) {
				this.loadstatus = '没有更多了'
			}
		},
		// 下拉刷新
		onPullDownRefresh() {
			this.list = []
			this.page = 1
			this.postlist()
			uni.stopPullDownRefresh(); //停止刷新
			// this.xialashow = true
		},
		methods: {
			postlist() {

				this.api.post('user/integralinfo', {
					page: this.page,
					size: 10,
				}).then(res => {
					console.log(res);
					if (res.code == 200) {
						this.pageConten = res.ext.pageCount
						this.list = this.list.concat(res.data);
						this.balance = res.ext.integral
						this.page >= this.pageConten ? this.loadstatus = '没有更多了' : this.loadstatus = '上拉加载更多'


					}


				})
			},
			jump() {
				uni.navigateTo({
					url: '/pagesA/my_user_Recharge/my_user_Recharge'
				})
			}
		}
	}
</script>

<style>
	.mianimg {
		width: 69rpx;
		height: 69rpx;
		background: #82D713;
		border-radius: 50%;
	}

	.lis {
		padding: 20rpx 30rpx;
		box-sizing: border-box;
		border-bottom: 1px solid #efefef;
		background-color: #fff;
	}

	.btnbal {
		width: 230rpx;
		height: 62rpx;
		background: #FFFFFF;
		border-radius: 28rpx;
	}

	.jiantouimg {
		width: 44rpx;
		height: 44rpx;
		border-radius: 50%;
		margin-left: 30rpx;
	}

	.toppar {

		width: 100%;
		padding: 25rpx;
		box-sizing: border-box;
		background-color: #feb746;
	}

	.userbtn {
		width: 101rpx;
		height: 33rpx;
		background: linear-gradient(253deg, #FEBE3D, #FF890A);
		border-radius: 17rpx;
		font-size: 20rpx;
		color: #FFFFFF;
	}

	.userimg {
		width: 114rpx;
		height: 114rpx;
		border-radius: 60rpx;
	}

	.topimg {
		height: 317rpx;
		width: 100%;
	}
</style>